import Home from '@/views/Home'
import Search from '@/views/Search'
import Vue from 'vue'
import VueRouter from 'vue-router'
import NotFound from "@/views/NotFound.vue";

Vue.use(VueRouter)

const router = new VueRouter({
    /* hash 模式带 #，history 是不带 # 的 */
    mode: "history",
    routes: [
        /* 配置路由重定向，当匹配到 path 时，会重定向到 redirect 中的路径 */
        {path: "/", redirect: "/home"},
        {path: '/home', component: Home},
        {name: "search", path: '/search/:words?', component: Search},
        /* 404 配置，配置到最底部 */
        {path: "*", component: NotFound}
    ]
})

export default router